package com.snapan.service.impl;

import com.snapan.dao.FileHistoryDao;
import com.snapan.entity.FileHistory;
import com.snapan.service.FileHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FileHistoryServiceImpl implements FileHistoryService {
    @Autowired
    private FileHistoryDao historyDao;

    @Override
    public int recordHistory(FileHistory fileHistory) {
        return historyDao.insert(fileHistory);
    }

    @Override
    public List<FileHistory> getUserHistory(Long userId,String currentPage) {
        return historyDao.selectByUserId(userId, 10,currentPage); // 默认查最近10条历史
    }

    @Override
    public int clearUserHistory(Long userId,Long id) {
        return historyDao.deleteByUserId(userId,id);
    }
}
